//
//  GXIconLabelView.m
//  10-TableViewCellHomework
//
//  Created by 曹曹 on 16/7/27.
//  Copyright © 2016年 曹曹. All rights reserved.
//

#import "GXIconLabelView.h"
#import "UIView+Frame.h"

@implementation GXIconLabelView

- (instancetype)initWithFrame:(CGRect)frame
                             image:(NSString *)imageName
                        bottomText:(NSString *)text {
    self = [super initWithFrame:frame];
    if (self) {
        UIButton *button = [UIButton buttonWithType:UIButtonTypeCustom];
        button.frame = CGRectMake(0, 0, self.gx_height * 2 / 3, self.gx_height * 2 / 3);
        button.center = CGPointMake(self.gx_width / 2, self.gx_height / 3);
        [button setImage:[UIImage imageNamed:imageName] forState:UIControlStateNormal];
        [self addSubview:button];
        UILabel *label = [[UILabel alloc] initWithFrame:CGRectMake(0, button.gx_height, self.gx_width, self.gx_height / 3)];
        label.text = text;
        if (label.frame.size.width < 78) {
            
        }
        label.textAlignment = NSTextAlignmentCenter;
        [self addSubview:label];
    }
    return self;
}

@end
